import type { ConsultPayParams, DepAll, OrderDetail, PostPatientConsultOrderParams, PostUploadData } from '@/types/consult'
import { request, service } from '@/utils/request'

export const getDepAllAPI = () => {
  return request<DepAll[]>('/dep/all')
}

export const uploadImageAPI = (filePath: string) => {
  return request<PostUploadData>(
    '/upload', // 接口路径
    'UPLOAD', // 上传文件
    {},
    {
      name: 'file', // 后端参数对应的 key
      filePath, // 要上传文件资源的路径
    }
  )
}

export const postPatientConsultOrderAPI = (data: PostPatientConsultOrderParams) => {
  return request<{ id: string }>('/patient/consult/order', 'POST', data)
}

export const postPatientConsultPayApi = (data: ConsultPayParams) => {
  return request<{payUrl:string}>('/patient/consult/pay', 'POST', data)
}

export const orderDetailApi = (orderId: string) => {
  return request<OrderDetail>('/patient/consult/order/detail', 'GET', { orderId })
}
